
A WordPress site can return a fatal memory error even when the hosting account has plenty of disk space. PHP memory is a separate resource: it limits how much memory a single PHP process may allocate while handling a request. Raising that limit can help a legitimate workload, but it can also hide a plugin or theme that consumes far more memory than it should.
To troubleshoot correctly, identify which limit is active, which request is failing, and whether usage is expected for that operation.
The memory_limit directive places a ceiling on memory allocation by a PHP script. It is not the total RAM installed in the server, and it is not necessarily the amount available to every process at the same time. A server may run many PHP workers concurrently, each with its own workload and constraints.
For example, a large import or image-processing task may use more memory than an ordinary page view. If many such tasks run at once, the total server load can be significant even when each process remains below its individual limit.
A typical fatal message says that PHP exhausted the allowed memory size while trying to allocate additional bytes. The message may identify a file and line, but that location is often where PHP ran out of room, not necessarily the original source of excessive allocation.
Record the exact error, timestamp, URL or administrative action, and whether it happens consistently. A failure only during media processing suggests a different investigation than a failure on every page load.
PHP settings can vary by version, domain, handler, and hosting control panel. A command-line PHP binary may use a different configuration from the PHP-FPM or web-server handler serving the website. Check the setting in the same execution context that fails.
In WordPress, the Site Health screen and hosting control panel may expose useful information. A temporary diagnostic script can also show the effective value, but remove it immediately after use and never leave a public phpinfo page available.
WordPress supports memory-related constants in wp-config.php, but a requested value cannot override a lower limit enforced by the PHP configuration or hosting platform. A setting in WordPress is not proof that PHP accepted it. Check the effective runtime value after making a change.
define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');
These values are examples, not universal recommendations. The appropriate limit depends on the site’s workload and the provider’s available resources. Avoid adding duplicate definitions, and understand that the administrative limit may be used for specific backend operations.
Look at the error log and correlate the failure with a page, plugin action, scheduled task, import, or update. If the error began after an extension update, test that extension in staging. Disable one suspected component at a time where practical, rather than making several unrelated changes that obscure the cause.
Large image manipulation, bulk imports, page builders, ecommerce reports, and poorly bounded queries can all require substantial memory. A plugin may also accumulate data in memory when processing a large collection instead of working in smaller batches.
| Resource | What it limits | Typical symptom |
|---|---|---|
| PHP memory_limit | Memory allocated by a PHP script | PHP fatal memory exhaustion |
| Execution time | How long a script may run | Request times out or is terminated |
| CPU quota | Processing time or share | Throttling or resource-limit event |
| PHP workers/processes | Concurrent request capacity | Requests queue or fail under load |
| Disk/inodes | Stored data or file count | Uploads or file creation fail |
Increasing PHP memory will not fix a process limit, a slow SQL query, a full filesystem, or a script that runs indefinitely.
A higher limit may be justified when a known operation legitimately requires more memory, the application supports that configuration, and the server has sufficient capacity. Test the change on staging and monitor concurrent load. If one plugin consumes several hundred megabytes for a routine request, investigate whether it can be configured more efficiently or replaced.
A memory limit is a guardrail, not a performance tuning strategy. Diagnose the failing operation, verify the active configuration, and distinguish legitimate demand from inefficient code. If a hosting plan enforces a lower cap, confirm the available options with the provider before changing application settings.